package com.yuyou.tas.lesson.mapper;

import com.yuyou.tas.service.api.lesson.dto.DtoBaseTerm;
import com.yuyou.tas.service.api.lesson.entity.BaseTrimester;
import com.yuyou.tas.util.bean.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface BaseTrimesterMapper {
    int deleteByPrimaryKey(Long id);

    int insert(BaseTrimester record);

    BaseTrimester selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(BaseTrimester record);

    int findTermCount(Pagination<DtoBaseTerm> queryPgn);

    List<DtoBaseTerm> findTermPageList(Pagination<DtoBaseTerm> queryPgn);

    int findUserTermCount(Pagination<DtoBaseTerm> queryPgn);

    List<DtoBaseTerm> findUserTermPageList(Pagination<DtoBaseTerm> queryPgn);

    BaseTrimester selectByPKandOrgan(@Param(value="id") Long id, @Param(value="authOrganizationId") Long authOrganizationId);

    BaseTrimester selectByCode7Organ(@Param(value="code") String code, @Param(value="authOrganizationId") Long authOrganizationId);
    
    BaseTrimester selectByOrgan7OId(@Param(value="oId") Long oId, @Param(value="authOrganizationId") Long authOrganizationId);
    
    int delByOrgan7OId(@Param(value="oId") Long oId, @Param(value="authOrganizationId") Long authOrganizationId);
       
    List<BaseTrimester> findTerms(Map<String , Object> condition);

    Long findMaxCode(Map<String , Object> condition);
    
    /**
     * 根据机构主键查找所有学期
     * @param authOrganizationId
     * @return
     */
    List<BaseTrimester> findTrimByOran(@Param(value="authOrganizationId") Long authOrganizationId);
}